import axios from "axios";

const request = axios.create({
    baseURL: '/api',
    timeout: 5000
})

// 请求拦截器

// 响应拦截器
request.interceptors.response.use(
    (response) => {
        const { success, message, data} = response.data
        if(success) {
            return data
        }else {
            console.log("请求未成功");
        }
        return Promise.reject(new Error(message))
    }
)

export default request